package com.dmgis.hndz.common.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class FileConfig implements WebMvcConfigurer {
    @Value("${nginx.filepath}")
    private String attachmentPath;
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/**") //虚拟url路径
        		//.addResourceLocations("file:D:/images/");
                .addResourceLocations("file:" + attachmentPath); //真实本地路径
    }
}
